<?php
	if(!isset($_SESSION['user_id']))
	{
		header("Location:index.php");
	}
	if(!isset($_SESSION['city']) || !isset($_SESSION['dob']) || !isset($_SESSION['gender']))
	{
		header("Location:index.php");
	}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta name="Description" content="..." />
    <meta name="Keywords" content="..." />
    <meta name="robots" content="all,follow" />
    <meta name="author" content="Cynosure Web Solutions" />
    <meta name="copyright" content="Cynosure Web Solutions" />
    <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- CSS -->
    <link rel="stylesheet" href="view/css/style.css" type="text/css" media="screen, projection, tv" />
    <link rel="stylesheet" href="view/css/jquery-ui.css" type="text/css" media="screen, projection, tv" />
    <link rel="stylesheet" href="view/css/profile.css" type="text/css" media="screen, projection, tv" />
    
	<link rel="stylesheet" type="text/css" href="view/css/jquery.fancybox.css?v=2.0.6" media="screen" />
    <link rel="stylesheet" type="text/css" href="view/css/jquery.fancybox-buttons.css?v=1.0.2" />
    <link rel="stylesheet" type="text/css" href="view/css/jquery.fancybox-thumbs.css?v=1.0.2" />


    <!--[if lt IE 8]>
		<div style=' clear: both; text-align:center; position: relative;z-index:100;'>
			<a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." /></a>
		</div>
	<![endif]-->
    <link rel="stylesheet" href="view/css/style-print.css" type="text/css" media="print" />
    <link rel="shortcut icon" href="view/favicon.ico" type="image/x-icon" />
    
    <title>Vault Empire</title>

    <script type='text/javascript' src='view/js/jquery-1.5.1.min.js?ver=1.5.1'></script>
	<script type="text/javascript" src="view/js/jquery.mousewheel-3.0.6.pack.js"></script>
   	<script type="text/javascript" src="view/js/jquery.fancybox.pack.js?v=2.0.6"></script>
   	<script type="text/javascript" src="view/js/jquery.fancybox-buttons.js?v=1.0.2"></script>
   	<script type="text/javascript" src="view/js/jquery.fancybox-thumbs.js?v=1.0.2"></script>
	<script type="text/javascript" src="view/js/jquery.fancybox-media.js?v=1.0.0"></script>
    <script type='text/javascript' src='view/js/jquery-ui.js?ver=1.5.1'></script>
	<script type='text/javascript' src='view/js/script.js'></script>
    <script type='text/javascript' src='view/js/jquery.lavalamp.js?ver=3.3.1'></script>
    <script type='text/javascript' src='view/js/lavalamp-config.js?ver=3.3.1'></script>
    <script type='text/javascript' src='view/js/jquery.easing.1.1.js?ver=3.3.1'></script>

    <!--menu-->
    <style type="text/css" media="all">
        /* line at menu top */#topnav li.back
        {
            border-top: 2px solid #c0c0c0;
        }
        /* bg color container */#container
        {
            background-color: #ffffff;
        }
        /*slider*/</style>
    <!--menu END-->

    <script type="text/javascript" src="view/js/jquery.autoresize.js"></script>
    <script type="text/javascript" language="javascript">
     $(document).ready(function() {
          $('#mytextbox').focus(function() {
               $(this).animate({width: '350px'}, 500);
          });
 
          $('#mytextbox').blur(function() {
               $(this).animate({width: '160px'}, 500);
          });
		 
			$("#showFriends").click(function() {
						$.fancybox.open({
							href : 'view/friendList.php?id=<?php echo $_SESSION['user_id']; ?>',
							type : 'iframe',
							padding : 5,
							width : 400
						});
					});
			 });
    </script>
    

    

    <!--<tabbed_menu>-->
    <link rel="stylesheet" type="text/css" href="view/tabbed_menu_css/tabcontent.css" />
    <script type="text/javascript" src="view/tabbed_menu_js/tabcontent.js"></script>
    <!--</tabbed_End>-->
    
    <!--<Menu>-->
    <script type="text/javascript">
        $(document).ready(function() {
            $(".dropdown img.flag").addClass("flagvisibility");

            $(".dropdown dt a").click(function() {
                $(".dropdown dd ul").toggle();
            });
                        
            $(".dropdown dd ul li a").click(function() {
                var text = $(this).html();
                $(".dropdown dt a span").html(text);
                $(".dropdown dd ul").hide();
                $("#result").html("Selected value is: " + getSelectedValue("sample"));
            });
                        
            function getSelectedValue(id) {
                return $("#" + id).find("dt a span.value").html();
            }

            $(document).bind('click', function(e) {
                var $clicked = $(e.target);
                if (! $clicked.parents().hasClass("dropdown"))
                    $(".dropdown dd ul").hide();
            });


            $("#flagSwitcher").click(function() {
                $(".dropdown img.flag").toggleClass("flagvisibility");
            });
        });
    </script>

    <!--</Menu>-->

    
</head>
<body>
    <div id="main">
        <!-- Header -->
        <?php include("view/header.php"); ?>
        <!-- Header end -->
        <div id="content">
            <!-- Content box with white background and gray border -->
            <div id="content-box">
                <div id="profilebox">
                    <div id="content-profile">
                        <div id="logo">
                            <img alt="" src="view/img/logo.png" width="180px" />
                        </div>
                        <div class="profilepic">
							<?php
								if($userDetail[0]['profilepic'] == "")
								{
									if($userDetail[0]['gender'] == "male")
									{
										$profilepic = "view/img/male-icon.jpg";
									}
									else
									{
										$profilepic = "view/img/female-icon.jpg";
									}
								}
								?>
                            <img alt="" src="<?php echo $profilepic;?>" />
                        </div>
                    </div>
                    <div id="profilecontent">
                        <table>
                            <tr>
                                <td width="520">
                                	Messages
                                    
                                    <?php $model = new Model();
                                		$ans = $model->getMessages();
										
										foreach($ans as $row)
                                		{
										?>
                                    	<table id="msg">
                                        
                                            <tr>
                                            	<td width="100"><?php echo $row['fullname']; ?></td><td style="overflow:scroll;"><?php echo $row['message']; ?></td>
                                            </tr>
                                           <?php
										    $m=$row['msg_id'];
										    $model = new Model();
                                			$ans1 = $model->getReply($m);
											
											foreach($ans1 as $row1)
                                			{
										?>
                                           <tr>
                                           		<td><?php echo $_SESSION['fullname']; ?></td>
                                                <td>
                                                	<?php
															echo $row1['message'];
													 ?>
                                                </td>
                                           </tr>
                                           <?php } 
											
											
											?>
                                           
                                           
                                           <tr>
                                           		<td colspan="2" align="right"> 
                                           		<a href="index.php?action=reply&from=<?php echo $row['from_user_id']; ?>&mid=<?php echo $row['msg_id']; ?>" id="reply" target="_parent" class="linkname">Reply</a>
                                                </td>
                                           </tr>
                                            
										
                                        </table>
                                    	<?php 
										}
										?>
                                </td>
                                <td valign="top">
                                    <table class="detailstableinner">
                                        <tr>
                                            <td>
                                                <div class="buttons">
                                                    <button type="submit" class="positive" name="save" id="showFriends">
                                                        <img src="view/img/buttons/btn_icons/friends.png" alt="" />
                                                        Friends{<?php echo $friendsCount; ?>}
                                                    </button>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                            	<div class="buttons">
												<a href="index.php?action=vault" target="_parent" class="linkname" >
                                                    <button type="submit" class="positive" name="save" id="showFriends1">
                                                    <img src="view/img/buttons/btn_icons/friends.png" alt="" />
                                                    valt
                                                    </button>
                                                </a>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                            	<div class="buttons">
												<a href="index.php?action=messages" target="_parent" class="linkname">
                                                    <button type="submit" class="positive" name="save" id="msg">
                                                    <img src="view/img/buttons/btn_icons/friends.png" alt="" />
                                                    Messages
                                                    </button>
                                                </a>
                                                </div>
                                            </td>
                                        </tr>
                                        
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                
                
        <!-- Footer -->
        <?php include("view/footer.php"); ?>
        <!-- Footer end -->
    </div>
</body>
</html>
